package com.hkts.beltweigher.master.service.serviceimpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hkts.beltweigher.master.entity.Displaydata;
import com.hkts.beltweigher.master.mapper.DisplaydataMapper;
import com.hkts.beltweigher.master.service.IDisplaydataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author hml
 * @since 2024-04-10
 */
@Service
@Transactional
public class DisplaydataServiceImpl extends ServiceImpl<DisplaydataMapper, Displaydata> implements IDisplaydataService {


    @Autowired
    private DisplaydataMapper displaydataMapper;

    @Override
    public IPage<Displaydata> selectPage(Page<Displaydata> page, Displaydata displaydata) {
        QueryWrapper<Displaydata> query = Wrappers.query();
        return displaydataMapper.selectPage(page, query);
    }


    @Override
    public List<Displaydata> selectList(Displaydata displaydata) {
        QueryWrapper<Displaydata> query = Wrappers.query();
        query.lambda().eq(displaydata.getDataStatus() != null, Displaydata::getDataStatus, displaydata.getDataStatus());
        return displaydataMapper.selectList(query);
    }
}
